package xio.ccf_201412;
/**
 * 201412-2	Z字形扫描 100分
 * Created by Xio on 2017/11/3
 */

import java.util.Scanner;

public class ZScan {
	 public static void main(String[] args) {
		   
		 Scanner sc = new Scanner(System.in);
		 int n = sc.nextInt();
		 int[][] src = new int[n][n];
		 for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				src[i][j] = sc.nextInt();
			}
		}
		 
		 for (int i = 0; i < n; i++) {
			for (int x = i,y=0; x >= 0; x--,y++) {
				if (i%2==0) {
					System.out.print(src[x][y]+" ");
				}else {
					System.out.print(src[y][x]+" ");
				}
			}
		}
		 
		 for (int i = n-1; i > 0; i--) {
			 for (int x = n-1,y=n-i; y < n; x--,y++) {
					if (i%2==0) {
						System.out.print(src[y][x]+" ");
					}else {
						System.out.print(src[x][y]+" ");
					}
				}
			}
			
	   }
}
